<?php
	if (!defined('LOGIN')){
    	define('LOGIN', 1);
	}
    if ($login->isLoggedIn())
    {
        $this->redirect('index.php?module=main');
        exit;
    } //$login->isLoggedIn()
    if (count($_POST))
    {
        $username = $this->get('username');
        $password = $this->get('password');
        $login->login($username, $password);
        if ($login->isLoggedIn())
        {
            if ($req['ajax'])
            {
                echo 'ok';
                exit;
            } //$req['ajax']
			if ($this->isNormal($login))
			{
            	$this->redirect('index.php?module=main');
			}
			else
			{
            	$this->redirect('index.php?module=pos');
			}
            exit;
        } //$login->isLoggedIn()
        else
        {
            $this->error = "Either your username/password is invalid.";
        }
    } //count($_POST)
?>